package com.draven.member.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.draven.member.entity.Member;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MemberMapper extends BaseMapper<Member> {

    @Select("SELECT * FROM member WHERE id = #{id}")
    Member findById(Long id);

    @Select("SELECT * FROM member")
    List<Member> findAll();

    @Update("UPDATE member SET nickname = #{nickname}, avatar_url = #{avatarUrl}, gender = #{gender}, " +
            "birthday = #{birthday}, address = #{address}, email = #{email}, phone = #{phone}, status = #{status} " +
            "WHERE id = #{id}")
    void update(Member member);

    @Delete("DELETE FROM member WHERE id = #{id}")
    void deleteById(Long id);
}